//
//  PushListViewController.m
//  基本框架
//
//  Created by runone02 on 2018/8/22.
//  Copyright © 2018年 liqiyun. All rights reserved.
//

#import "PushListViewController.h"
#import "YZNavigationMenuView.h"
@interface PushListViewController ()<YZNavigationMenuViewDelegate>

@end

@implementation PushListViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setupNavView];
}

- (void)setupNavView{
    WeakSelf(weakSelf);
    [self.navView.leftButton setTitle:@"返回" forState:UIControlStateNormal];
    [self.navView.centerButton setTitle:@"点击弹出" forState:UIControlStateNormal];
    [self.navView.rightButton setTitle:@"弹出" forState:UIControlStateNormal];

    self.navView.cenTerButtonBlock = ^{
         [weakSelf leftBarButtonItemClicked];
    };
    self.navView.rightButtonBlock = ^{
         [weakSelf rightBarButtonItemClicked];
    };
}

- (void)rightBarButtonItemClicked{
    NSMutableArray *imageArray = [NSMutableArray arrayWithCapacity:0];
    for (int i = 0; i < 6; i++) {
        NSString *name = [NSString stringWithFormat:@"%d",i + 1];
        UIImage *image  = [UIImage imageNamed:name];
        [imageArray addObject:image];
    }
    YZNavigationMenuView *menuView = [[YZNavigationMenuView alloc] initWithPositionOfDirection:CGPointMake(self.view.frame.size.width - 24, kTopBarHeight) images:imageArray titleArray:@[@"我是第一栏",@"我是第二栏",@"我是第三栏",@"我是第四栏",@"我是第五栏",@"我是最后一栏",]];
    menuView.delegate = self;
    [self.view addSubview:menuView];
}

- (void)leftBarButtonItemClicked{
    NSMutableArray *imageArray = [NSMutableArray arrayWithCapacity:0];
    for (int i = 0; i < 6; i++) {
        NSString *name = [NSString stringWithFormat:@"%d",i + 1];
        [imageArray addObject:name];
    }
    
    YZNavigationMenuView *menuView = [[YZNavigationMenuView alloc] initWithPositionOfDirection:CGPointMake(SCREEN_WIDTH/2  , kTopBarHeight) images:imageArray titleArray:@[@"我是第一栏",@"我是第二栏",@"我是第三栏",@"我是第四栏",@"我是第五栏",@"我是最后一栏"]];
    menuView.clickedBlock = ^(NSInteger index){   //左侧点击(点击方法回调)
        NSLog(@"左边第%ld栏",index + 1);
    };
    [self.view addSubview:menuView];
}

//右侧点击(点击方法回调)
- (void)navigationMenuView:(YZNavigationMenuView *)menuView clickedAtIndex:(NSInteger)index;{
    NSLog(@"什么%ld❓",index + 1);
}

@end
